package tiandang.core.dao;

import org.apache.ibatis.annotations.Param;
import tiandang.core.model.OrderInfo;

import java.util.List;

public interface OrderMapper {
  int insertSelective(OrderInfo record);

  OrderInfo selectByPrimaryKey(String id);

  void deliverProduct(@Param("id") String id);


  //后台订单页面查询
  List<OrderInfo> getListByPromoTime(@Param("startTimestamp") Long startTimestamp,
                                     @Param("endTimestamp") Long endTimestamp,
                                     @Param("limit") Integer limit, @Param("offset") Integer offset);

  int countByPromoTime(@Param("startTimestamp") Long startTimestamp,
                       @Param("endTimestamp") Long endTimestamp);

  List<OrderInfo> getListByManagerName(@Param("managerName") String managerName,
                                       @Param("limit") Integer limit, @Param("offset") Integer offset);

  int countByManagerName(@Param("managerName") String managerName);


  List<OrderInfo> getListByProductName(@Param("productName") String productName,
                                       @Param("limit") Integer limit, @Param("offset") Integer offset);

  int countByProductName(@Param("productName") String productName);


  List<OrderInfo> getListByDeliveryStatus(@Param("deliveryStatus") Integer deliveryStatus,
                                          @Param("limit") Integer limit, @Param("offset") Integer offset);

  int countByDeliveryStatus(@Param("deliveryStatus") Integer deliveryStatus);

  List<OrderInfo> getListByPage(@Param("limit") Integer limit, @Param("offset") Integer offset);

  int countAllOrders();


  //  导出excel的查询
  List<OrderInfo> getAllByPromoTime(@Param("startTimestamp") Long startTimestamp,
                                    @Param("endTimestamp") Long endTimestamp);

  List<OrderInfo> getAllByManagerName(@Param("managerName") String managerName);

  List<OrderInfo> getAllByProductName(@Param("productName") String productName);


  List<OrderInfo> getAllByDeliveryStatus(@Param("deliveryStatus") Integer deliveryStatus);

  List<OrderInfo> getAll();

  List<OrderInfo> getListByPromoId(@Param("promoId") Integer promoId);

  void updatePayStatusByOrderId(@Param("id") String id);

  List<OrderInfo> getListByOpenid(@Param("openid") String openid,
                                  @Param("limit") Integer limit, @Param("offset") Integer offset);

  int countByOpenid(@Param("openid") String openid);

  List<OrderInfo> getUnPayOrder();

  void updateOrderStatus(@Param("id") String id, @Param("orderStatus") Integer orderStatus);

  List<OrderInfo> getPayedAndCancelStatusOrder();
}